package com.atguigu.dga.governance.assess.spec;

import com.atguigu.dga.governance.assess.Assessor;
import com.atguigu.dga.governance.bean.AssessParam;
import com.atguigu.dga.governance.bean.GovernanceAssessDetail;
import com.atguigu.dga.governance.bean.GovernanceMetric;
import com.atguigu.dga.meta.bean.TableMetaInfo;
import com.atguigu.dga.meta.constant.CodeConst;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component("BUSI_OWNER")
public class BusiOwnerAssessor extends Assessor {
    @Override
    public void checkProblem(GovernanceAssessDetail governanceAssessDetail , AssessParam assessParam) {
        GovernanceMetric governanceMetric = assessParam.getGovernanceMetric();
        TableMetaInfo tableMetaInfo = assessParam.getTableMetaInfo();

       // System.out.println("表 [" + tableMetaInfo.getTableName() +"] : 考评指标："+governanceMetric.getMetricName() );
        if(tableMetaInfo.getTableMetaInfoExtra().getBusiOwnerUserName()==null
                ||tableMetaInfo.getTableMetaInfoExtra().getBusiOwnerUserName().trim().length()==0
             || tableMetaInfo.getTableMetaInfoExtra().getBusiOwnerUserName().equals(CodeConst.OWNER_UNSET)){
            governanceAssessDetail.setAssessScore(BigDecimal.ZERO);
            governanceAssessDetail.setAssessProblem("未填写业务负责人");

            ////table_meta/table_meta/detail?tableId={tableId}
            String governanceUrl = governanceMetric.getGovernanceUrl();
            governanceUrl=  governanceUrl.replace("{tableId}",tableMetaInfo.getId()+"");
            governanceAssessDetail.setGovernanceUrl(governanceUrl);
        }



    }
//    @Override
//    public GovernanceAssessDetail metricAssess(TableMetaInfo tableMetaInfo, GovernanceMetric governanceMetric) {
//           // 每个指标共同的
//        GovernanceAssessDetail governanceAssessDetail = new GovernanceAssessDetail();
//
//
//        // 每个指标特有的

//
//
//
//        return new GovernanceAssessDetail();
//    }
}
